/**
 * Created by user on 2019/3/20.
 */
// 人群显示
function Type(data){
    var typeList = [
        {
            id:'1',
            name:'高血压人群',
        },
        {
            id:'2',
            name:'糖尿病人群',
        },
        {
            id:'3',
            name:'高血脂人群',
        },
        {
            id:'4',
            name:'骨松人群'
        }
    ]
    var arr1 = [];
    var str = ''
    if( data != '' && data != null ){
        if( data.split(",").length == 1 ){
            if( data == '1' ){
                str = "高血压人群"
            }else if( data == '2' ){
                str = "糖尿病人群"
            }else if( data == '3' ){
                str = "高血脂人群"
            }else if( data == '4' ){
                str = "骨松人群"
            }
        }else{
            arr1 = data.split(",");
            console.debug(arr1);
            var names = []
            typeList.forEach((item,index)=>{
                for( var a = 0; a < arr1.length; a++ ){
                    if( item.id == arr1[a] ){
                        names.push(item.name)
                    }
                }
            });
            console.debug(names);
            str = names.toString()
        }
    }else{
        str = ''
    }
    return str
}

// 根据人群类型文字判断
// 人群显示
function typePerson(data){
    var typeList = [
        {
            id:'1',
            name:'高血压人群',
        },
        {
            id:'2',
            name:'糖尿病人群',
        },
        {
            id:'3',
            name:'高血脂人群',
        },
        {
            id:'4',
            name:'骨松人群'
        }
    ]
    var arr1 = [];
    var str = ''
    if( data != '' && data != null ){
        if( data.split(",").length == 1 ){
            if( data == '高血压人群' ){
                str = "1"
            }else if( data == '糖尿病人群' ){
                str = "2"
            }else if( data == '高血脂人群' ){
                str = "3"
            }else if( data == '骨松人群' ){
                str = "4"
            }
        }else{
            arr1 = data.split(",");
            var names = []
            typeList.forEach((item,index)=>{
                for( var a = 0; a < arr1.length; a++ ){
                    if( item.name == arr1[a] ){
                        names.push(item.id)
                    }
                }
            })
            str = names.toString()
        }
    }else{
        str = ''
    }
    return str
}